import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/*
 * @Author: 小胖沱 1643200914@qq.com
 * @Date: 2022-12-19 14:08:38
 * @LastEditors: 小胖沱 1643200914@qq.com
 * @LastEditTime: 2023-01-05 11:27:49
 * @FilePath: \jk_sort_front\src\pages\QueryReport\ProductionBroad\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import classNames from 'classnames';
import { useEffect, useState } from 'react';
import useIsFullScreen from '@/components/useIsFullScreen';
import { reportGetProductionDashboard } from '@/recoil/productionBroad/api';
import Attendance from './components/attendance';
import BoardHead from './components/boardHead';
import FinishChart from './components/finishChart';
import ReservoirInventory from './components/reservoirInventory';
import StockNumber from './components/stockNumber';
import VoucherProduction from './components/voucherProduction';
import styles from './index.module.less';
export default () => {
    const [voucherData, setVoucherData] = useState([]);
    const [completedData, setCompletedData] = useState([]);
    const [areaStockData, setAreaStockData] = useState([]);
    const [ironData, setIronData] = useState([]);
    const [attendanceData, setAttendanceData] = useState({});
    const { isFull, toggleFullScreen } = useIsFullScreen();
    const getDashBoardData = () => {
        reportGetProductionDashboard().then((response) => {
            if (response.success) {
                const { data = {} } = response;
                const { styleCompletedAmountList, processesCompletedAmountList, areaStockList, ironAreaStyleStockList, actualAttendance } = data;
                setVoucherData([...styleCompletedAmountList]);
                setCompletedData([...processesCompletedAmountList]);
                setAreaStockData([...areaStockList]);
                setIronData([...ironAreaStyleStockList]);
                setAttendanceData({ ...actualAttendance });
            }
        });
    };
    useEffect(() => {
        getDashBoardData();
        const timer = setInterval(() => {
            getDashBoardData();
        }, 10000);
        return () => {
            clearInterval(timer);
        };
    }, []);
    useEffect(() => {
        // setTimeout(() => {
        //   if (toggleFullScreen) {
        //     toggleFullScreen()
        //   }
        // }, 2000)
    }, [toggleFullScreen]);
    return (_jsxs("div", { className: classNames(styles.container, styles.screen), children: [_jsx(BoardHead, { title: "\u540E\u9053\u5206\u62E3\u751F\u4EA7\u770B\u677F" }), _jsxs("div", { className: styles.chartBox, children: [_jsxs("div", { className: styles.chartLeft, children: [_jsxs("div", { className: styles.leftTop, children: [_jsx("div", { className: styles.voucher, children: _jsx(VoucherProduction, { data: voucherData }) }), _jsx("div", { className: styles.finishNumber, children: _jsx(FinishChart, { data: completedData }) })] }), _jsx("div", { className: styles.leftBottom, children: _jsx(StockNumber, { data: ironData }) })] }), _jsxs("div", { className: styles.chartRight, children: [_jsx("div", { className: styles.inventoryBox, children: _jsx(ReservoirInventory, { data: areaStockData }) }), _jsx("div", { className: styles.attendance, children: _jsx(Attendance, { data: attendanceData }) })] })] })] }));
};
